home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12592 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.4 KB

  1. Path: news.luc.edu!user
  2. From: VArase@varase.it.luc.edu (Verne Arase)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Borland C's tmpnam()
  5. Date: Mon, 01 Apr 1996 16:16:52 -0600
  6. Organization: LUMC
  7. Message-ID: <AD85B1F49668E2D54@mcdiala11.it.luc.edu>
  8. References: <AD75E5DC9668E2A52@mcdiala13.it.luc.edu> <Pine.A32.3.91.960322134158.23347A-100000@red.weeg.uiowa.edu> <AD78E5E796681EC58@mcdialb10.it.luc.edu> <827626790snz@genesis.demon.co.uk> <AD7CDFD39668AABD2@mcdiala01.it.luc.edu> <828276946snz@genesis.demon.co.uk> <AD84A73496681719A2@mcdiala03.it.luc.edu> <Pine.A32.3.91.960331232036.17351F-100000@red.weeg.uiowa.edu>
  9. NNTP-Posting-Host: 147.126.240.111
  10.  
  11. In article <Pine.A32.3.91.960331232036.17351F-100000@red.weeg.uiowa.edu>,
  12. The Amorphous Mass <robinson@blue.weeg.uiowa.edu> wrote:
  13.  
  14.  >> All it does it insure that the file name doesn't exist in the current
  15.  >> location in the file system. Which, I'd imagine, is what just about
  16. every
  17.  >> implementation does.
  18.  >
  19.  >  As far as the file system is concerned, two files named "foo" in 
  20.  >different directories _don't_ have the same name, because the full 
  21.  >pathname is used as a unique identifier.  Note that versions of C for the
  22.  
  23.  >original Mac file system (which only provided the illusion of folders, 
  24.  >and didn't allow any two files to have the same name) would in fact have 
  25.  >had to come up with a totally unique filename.
  26.  
  27. As MFS only created the _illusion_ of folders, all files _were_ in the same
  28. location in the file system.
  29.  
  30. As for the file names returned tmpnam(), they are _not_ complete path
  31. names. Therefore, they are only unique at the branch of the file system
  32. which is currently the default location.
  33.  
  34.  >> It's be a lot more useful if you could specify a target directory,
  35. though
  36.  >> the string that makes up that specification would be target environment
  37.  >> dependant.
  38.  >
  39.  >  If it's a temporary file, does it really matter where it ends up?  You 
  40.  >can always rename() it to another directory (using an implementation- 
  41.  >specific string) if you want to keep it after the program terminates.
  42.  
  43. I'm using
  44.  
  45.  1) Create a temporary
  46.  2) Update master into temporary
  47.  3) Delete master (or rename it to master.old)
  48.  4) Rename temporary to master
  49.  
  50. type logic. Creating the temporary file in the master's directory allows
  51. you to detect whether you have privilege or disk space problems early in
  52. processing (and before you blow away the old master).
  53.  
  54. ---
  55. The above are my own opinions, and not those of my employer.
  56.